#include "kgamemaster.h"

KGameMaster::KGameMaster(QWidget* parent) 
	: KGameMasterGui(parent) {
}

void KGameMaster::newFile(){
	
	QList<QTreeWidgetItem*> lItems = treePlaces->selectedItems();
	QTreeWidgetItem *item = lItems.at(0);
	
	QString type = item->data(0 , Qt::UserRole).toString();
	
	GridWidget *grid = createGridWidget(type);
	grid->setWindowTitle(type);
	grid->show();
}

GridWidget *KGameMaster::createGridWidget(){

	GridWidget *grid = new GridWidget(this, 8, 8, QString("Worldmap"));
	//GridWidget *grid = new GridWidget(this,800,800);
	centralwidget->addWindow(grid);

	return grid;
}

GridWidget *KGameMaster::createGridWidget(QString type){

	GridWidget *grid = new GridWidget(this, 8, 8, type);
	//GridWidget *grid = new GridWidget(this,800,800);
	centralwidget->addWindow(grid);

	return grid;
}
